<template>
  <div class="div3">
    <h3>请填写需要添加的用户信息</h3>
    <div>
      用户名称: <input type="text" v-model="username" /> <br /><br />
      密&emsp;&emsp;码: <input type="password" v-model="password" /><br /><br />
      所属岗位: <input type="text" v-model="position" /><br /><br />
      所属权限: <input type="text" v-model="permission" /><br /><br />
      所属角色: <input type="text" v-model="role" /><br /><br /> 
      所属部门: <input type="text" v-model="branch" /><br /><br />
      所属职级: <input type="text" v-model="rank" /><br /><br />
        <el-button @click="add">确定</el-button>
    </div>

  </div>
</template>

<script>
export default {
  name: "createuser",
  data() {
    return {
      username: "",
      password: "",
      position: "",
      role: "",
      branch: "",
      rank: "",
      permission: "",
      list:[],
    };
  },
  props: {},

  components: {},

  created() {},

  mounted() {
      
  },

  methods: {
    add() {
      this.axios
        .post("http://127.0.0.1:8000/rbac/v1/add/", {
          username: this.username,
          password: this.password,
          position: this.position,
          role: this.role,
          branch: this.branch,
          rank: this.rank,
          permission: this.permission,
        })
        .then((res) => {
          if (res.data.code == 200) {
            alert("添加成功");
          }
        })
        .catch((err) => {
          console.log(err);
          alert("添加失败");
        });
    },
    showbr(){
        this.axios.get('http://127.0.0.1:8000/rbac/v1/showbranch/').then(res=>{
          if (res.data.code ==200) {
              this.list == res.data.data
          }
      }).catch(err=>{
          console.log(err);
      })
    }

  },

  computed: {},

  watch: {},

  directives: {},

  filters: {},
};
</script>

<style scoped>
</style>
